﻿@using ToyStore.Domain.Store
@using ToyStore.Tasks
@using ToyStore.Web.Mvc.Common
@model ToyStore.Web.Mvc.Controllers.ViewModels.ProductListTemplateViewModel

@{
    bool isInCart = false;
    if (Model.ProductsInUserCard != null)
	{
        if (Model.ProductsInUserCard.Contains(Model.Product))
        {
            isInCart = true;
        }
    }
    string additionalRibbonClass = string.Empty;
    if (isInCart)
    {
        additionalRibbonClass = "ribbon_in_cart"; 
    }
        
            
}     


<div class="productListItemTemplate flipbox">
    <div class="ribbon @(additionalRibbonClass)"></div>
    <div>
        <div class="side side_active">
            <div class="rotate_ico"></div>
            <div class="pull-left">
                <div class="productListItemImage">
                <a href="http://www.onet.pl"><img rel="tooltip" data-original-title="@Model.Product.Name" src="@(Model.Product.SampleUrl)" alt="@(Model.Product.Name)"/></a>
                </div>
            </div>
            <div class="pull-left" style="width: 245px; height: 170px; overflow: hidden">
                <div class="productListDetailsContainer" style="margin: 5px 5px 5px 5px;">
                <div>
                    <div class="row">
                        <div class="span1" style="width: 250px"><h4> @(Html.ActionLink<ProductController>(c => c.Details(Model.Product.Id), @Model.Product.NameShort))</h4></div>  
                    </div>
               
                     <div class="row">
                        <div class="span1" style="width: 170px"><h5>@Model.Product.Author.Name</h5></div> 
                    </div>
			        <div class="row">
				        <div class="span4" style="width: 240px; text-align : justify; font-size: 10px">@(Model.Product.DescriptionShort) </div>  
			        </div>
			        <div style=" position: absolute; top: 150px; left : 120px;">
				        <div class="span1" style="width: 170px"><h4 style="color: #604796">Cena: @String.Format("{0:0.00} zł", Model.Product.PriceBrutto)</h4></div> 
			        </div>
			   @if (!isInCart)
                 { 
			        <div class="addToCart">
				   
                        @Html.ImageLink("AddProduct", "../../Content/img/ico_addtobasket.png", "Dodaj do koszyka", new { controller = "Cart", id = Model.Product.Id }, new { data_id = Model.Product.Id }, new { rel = "tooltip", data_original_title = "Dodaj do koszyka" })
                    
                    </div>
                 }
                </div>
                 </div>
             </div>
         </div>
         <div class="side" style="display:none">
            <div class="rotate_ico"></div>
            <div class="pull-left" style="padding:5px">
                <div class="row" >
				            <div class="span4" style="width: 240px; text-align : justify">@(Model.Product.Description.Length > 400 ? Model.Product.Description.Substring(0, 400) + "..." : Model.Product.Description) </div>  
		        </div>
            </div>
             <div class="pull-right" style="width: 120px;">
                <div class="productListItemImage">
                <a href="http://www.onet.pl"><img rel="tooltip" data-original-title="@Model.Product.Name" src="@(Model.Product.SampleUrl)" alt="@(Model.Product.Name)"/></a>
                </div>
            </div>
        
         </div>
     </div>
</div>